import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_demo/ui/pages/main/main.dart';
import 'package:flutter_demo/ui/pages/meal/meal.dart';

class AppRouter {
  // 路由列表
  static final Map<String, WidgetBuilder> routes = {
    MainPage.name: (ctx) => MainPage(),
    MealPage.name: (ctx) => MealPage(),
  };

  // 初始路由
  static final String initRoute = MainPage.name;

  // 异步路由
  static final RouteFactory generateRoute = (settings) {
    // if (settings.name == MainPage.name) {
    //   return MaterialPageRoute(
    //     builder: (ctx) {
    //       return MainPage(settings.arguments);
    //     }
    //   );
    // }

    return null;
  };

  // 404 路由
  static final RouteFactory unknownRoute = (settings) {
    // if (settings.name == MainPage.name) {
    //   return MaterialPageRoute(
    //     builder: (ctx) {
    //       return MainPage(settings.arguments);
    //     }
    //   );
    // }

    return null;
  };
}